package com.ganbo.stock.controller;


import com.ganbo.stock.service.impl.BigDealService;
import com.ganbo.stock.service.impl.CompanyService;
import com.ganbo.stock.service.impl.StockService;
import com.ganbo.stock.service.impl.SuperBigDealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/stock")
public class StockController {

    @Autowired
    StockService stockService;
    @Autowired
    CompanyService companyService;
    @Autowired
    BigDealService bigDealService;
    @Autowired
    SuperBigDealService superBigDealService;

    @GetMapping("/init")
    public String initStock() {
        stockService.init();
        return "SUCCESS";
    }

    @GetMapping("/companyInfo")
    public String companyInfo(String dm) {
        companyService.updateCompany();
        return "SUCCESS";
    }

    @GetMapping("/bigdeal")
    public String bigdeal() {
        bigDealService.fetchDayBigDeal();
        return "SUCCESS";
    }


    @GetMapping("/superBigdeal")
    public String superBigdeal() {
        superBigDealService.fetchLastDealDaySuperBigDeal();
        return "SUCCESS";
    }

}
